$.ajax({
    url: "findWeaponIconServlet",
    dataType: "json",
    type: "post",
    success: function (icons) {
        for (var i = 0; i < icons.length; i++) {
            var path = icons[i].path;
            var name = icons[i].name;
            var $b = "<a data-v-2952ed45=\"\" href=\"http://localhost:8080/demo01/showWeapon.html\" target=\"_blank\" class=\"collection-avatar__item\"><div data-v-2952ed45=\"\" class=\"collection-avatar__icon\" data-src=\"https://act-upload.mihoyo.com/wiki-user-upload/2024/08/23/75833613/21f8e062179c868c623afe7d421f45b9_3447379829755557630.png?x-oss-process=image/quality,q_75/resize,s_120\" lazy=\"loaded\" style=\"background-image: url('image"+"/"+path+"');\"><div data-v-2952ed45=\"\" class=\"red-point\"><!----></div></div> <div data-v-2952ed45=\"\" class=\"collection-avatar__title\">"+name+"</div></a>";
            $("#icon2").append($b);
        }
    }
});

$("input[name=find]").click(function (){
    find();
});

function find(){
    //获取数据
    var star=$("select[name=star]").val();
    var equip=$("select[name=equipment]").val();
    var attribute=$("select[name=attribute]").val();
    var obtain=$("select[name=obtain]").val();
    $.ajax({
        url:"allWeaponServlet",
        data:{"star":star,"equip":equip,"attribute":attribute,"obtain":obtain},
        type:"post",
        dataType:"json",
        success:function (weapons){
            $("#empty").empty()
            if (weapons.length==0){
                var $a="<div class=\"position-list__empty\">未检索到相关词条</div>";
                $("#empty").append($a);
                return;
            }else{
                $("#empty").empty()
                var $c=" <div data-v-da1466d0=\"\" data-v-f6b39406=\"\"class=\"position-list position-list--collectionAvatar\"\n" +
                    "layout=\"pc\"><div data-v-2952ed45=\"\" data-v-da1466d0=\"\"\n" +
                    "class=\"collection-avatar\" id=\"icon2\"></div></div>";
                $("#empty").append($c);
                for (var i=0;i<weapons.length;i++){
                    var path = weapons[i].path;
                    var name = weapons[i].name;
                    var $b = "<a data-v-2952ed45=\"\" href=\"http://localhost:8080/demo01/showWeapon.html\" target=\"_blank\" class=\"collection-avatar__item\"><div data-v-2952ed45=\"\" class=\"collection-avatar__icon\" data-src=\"https://act-upload.mihoyo.com/wiki-user-upload/2024/08/23/75833613/21f8e062179c868c623afe7d421f45b9_3447379829755557630.png?x-oss-process=image/quality,q_75/resize,s_120\" lazy=\"loaded\" style=\"background-image: url('image"+"/"+path+"');\"><div data-v-2952ed45=\"\" class=\"red-point\"><!----></div></div> <div data-v-2952ed45=\"\" class=\"collection-avatar__title\">"+name+"</div></a>";
                    $("#empty>div>div").append($b);
                }
            }
        }
    });
}
